package newcoder_exp.justPractise;

import org.junit.Test;

public class NC120 {
    public class Solution {
        public int NumberOf11(int n) {
            int t = n, count = 0, d = 1;
            while (t != 0) {
                if ((t & 1) == 1) count++;
                t >>>= 1;
            }
            return count;
        }

        public int NumberOf1(int n) {
            int t = n, count = 0;
            while (t != 0) {
                count++;
                t &= (t - 1);
            }
            return count;
        }
    }

    @Test
    public void test() {
        Solution s = new Solution();
        System.out.println( s.NumberOf1(100)  );      
    }
}
